<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script type="text/javascript">
  var mallProductCategorySpecListModule = (function(){
    var module = {
      init :function(){

      },
      shopclick:function(rowIndex, rowData){
        var specId = rowData.id;
        $("#product_cate_spec_vale_panel").panel(
                {
                  href:"mallProductCategorySpecValController.do?list&specid="+specId
                }
        );
      },
      update:function(){
            var rowsData = $('#mallProductCategorySpecList').datagrid('getSelections');
            if (!rowsData || rowsData.length==0) {
                tip('请选择编辑项目');
                return;
            }
            if (rowsData.length>1) {
                tip('请选择一条记录再编辑');
                return;
            }
            var status = rowsData[0].status;
            if(status != 1){
                createwindow("编辑","mallProductCategorySpecController.do?addorupdate&id="+rowsData[0].id);
            }else{//判断有无被引用
                $.ajax({
                    async : false,
                    cache : false,
                    type : 'get',
                    url : "mallProductCategorySpecController.do?isuses&id="+rowsData[0].id,// 请求的action路径
                    success : function(data) {
                        var d = $.parseJSON(data);
                        if (!d.success) {
                            alertTip(d.msg,"提示");
                        }else{
                            createwindow("编辑","mallProductCategorySpecController.do?addorupdate&id="+rowsData[0].id);
                        }
                    }
                });
            }
      },
    }
    return module;
  })();
</script>

<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
    <t:datagrid name="mallProductCategorySpecList" title="商品分类规格"
                actionUrl="mallProductCategorySpecController.do?datagrid&categoryid=${cateid}"
                idField="id" fit="true" pagination="false" onClick="mallProductCategorySpecListModule.shopclick">
      <t:dgCol title="编号" field="id" hidden="true"></t:dgCol>
      <t:dgCol title="规格名称" field="name"   width="120"></t:dgCol>
     <%-- <t:dgCol title="categoryid" field="categoryid"   width="120"></t:dgCol>--%>
      <t:dgCol title="数据类型" field="mallDatatypeEntity.datatypename"   width="120"></t:dgCol>
      <t:dgCol title="单位" field="unit"   width="120"></t:dgCol>
      <t:dgCol title="状态" field="status" replace="启用_1,禁用_0"  width="120"></t:dgCol>
      <t:dgCol title="创建人" field="createuserid"   width="120"></t:dgCol>
      <t:dgCol title="创建时间" field="createtime" formatter="yyyy-MM-dd hh:mm:ss"  width="120"></t:dgCol>
      <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
      <t:dgDelOpt title="删除" url="mallProductCategorySpecController.do?del&id={id}"/>
      <t:dgToolBar title="录入" icon="icon-add" url="mallProductCategorySpecController.do?addorupdate&categoryid=${cateid}" funname="add"></t:dgToolBar>
      <t:dgToolBar title="编辑" icon="icon-edit" url="mallProductCategorySpecController.do?addorupdate" funname="mallProductCategorySpecListModule.update"></t:dgToolBar>
      <t:dgToolBar title="查看" icon="icon-search" url="mallProductCategorySpecController.do?addorupdate" funname="detail"></t:dgToolBar>
    </t:datagrid>
  </div>
</div>



